package com.userInfoService.actuator;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import com.userInfoService.service.StatusService;
public class StatusHealth implements HealthIndicator{
	@Autowired
	private StatusService statusService;
	@Override
	public Health health() {
		String myStatus = statusService.getMyStatus();
		if(myStatus == null || !myStatus.equals("running")) {
			return Health.down().withDetail("Error", "MyStatus Is Not Running!").build();
		}
		return Health.up().build();
	}
}
